package org.alive.test.deadlock;

import org.alive.util.RandomUtil;

/**
 * Insert task.
 * 
 * @author XUHAILIN730
 * 
 */
public class InsertTask implements Runnable {

	private TaskDAO dao = new TaskDAO();

	public void run() {
		while (true) {
			String acctNo = RandomUtil.randomString(15);
			int result = dao.insertCustAndAcct(acctNo);
			// dao.deleteCustAndAcct(acctNo);
			StringBuffer sbMsg = new StringBuffer();
			sbMsg.append(Thread.currentThread().getName());
			sbMsg.append(" Done(Insert) acctNo = ").append(acctNo)
					.append(" result = ").append(result);
			System.out.println(sbMsg.toString());
		}
	}

}
